import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { ItemPageResult, ItemPageVO } from "./types";
/**
 * 查询用户列表
 *
 * @param queryParams
 */
export function getUserPage(
  queryParams?: ItemPageVO
): AxiosPromise<ItemPageResult> {
  return request({
    url: "/adminApi/user/page",
    method: "get",
    params: queryParams,
  });
}

/**
 * 新增用户
 *
 * @param data
 */
export function userCreate(data: ItemPageVO) {
  return request({
    url: "/adminApi/user/create",
    method: "post",
    data: data,
  });
}

/**
 * 修改用户
 *
 * @param data
 */
export function userUpdate(data: ItemPageVO) {
  return request({
    url: "/adminApi/user/update",
    method: "put",
    data: data,
  });
}

/**
 * 删除用户
 *
 * @param id
 */
export function userDelete(id: number) {
  return request({
    url: "/adminApi/user/delete?id=" + id,
    method: "delete",
  });
}
